<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
     <input type="text" v-model="message"  @keyup.enter="addlist">
     <h1 v-for="(item,index) in textlist" >{{index+1}}{{item.name}} </h1>
    </div>
    <script src="./vue.js"></script>
    <script>
        var app = new Vue({
            el:"#app",
            data:{
                message:"",
                textlist:[
                {name:'写代码1'},
                {name:'写代码2'},
                {name:'写代码3'}]
            },
            methods:{
                addlist:function(){
                    this.textlist.push({name:this.message});
                }
            }
        })
    </script>
</body>
</html>